/*
 * XML Type:  entity-result
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML entity-result(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class EntityResultImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityResult
{

    /**  */
	private static final long serialVersionUID = 4842638401164133103L;


	public EntityResultImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName FIELDRESULT$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "field-result");
    private static final javax.xml.namespace.QName ENTITYCLASS$2 =
        new javax.xml.namespace.QName("", "entity-class");
    private static final javax.xml.namespace.QName DISCRIMINATORCOLUMN$4 =
        new javax.xml.namespace.QName("", "discriminator-column");


    /**
     * Gets a List of "field-result" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult> getFieldResultList()
    {
        final class FieldResultList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult get(int i)
                { return EntityResultImpl.this.getFieldResultArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult old = EntityResultImpl.this.getFieldResultArray(i);
                EntityResultImpl.this.setFieldResultArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult o)
                { EntityResultImpl.this.insertNewFieldResult(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult old = EntityResultImpl.this.getFieldResultArray(i);
                EntityResultImpl.this.removeFieldResult(i);
                return old;
            }

            @Override
			public int size()
                { return EntityResultImpl.this.sizeOfFieldResultArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new FieldResultList();
        }
    }

    /**
     * Gets array of all "field-result" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult[] getFieldResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(FIELDRESULT$0, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "field-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult getFieldResultArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult)get_store().find_element_user(FIELDRESULT$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "field-result" element
     */
    public int sizeOfFieldResultArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(FIELDRESULT$0);
        }
    }

    /**
     * Sets array of all "field-result" element
     */
    public void setFieldResultArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult[] fieldResultArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(fieldResultArray, FIELDRESULT$0);
        }
    }

    /**
     * Sets ith "field-result" element
     */
    public void setFieldResultArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult fieldResult)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult)get_store().find_element_user(FIELDRESULT$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(fieldResult);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "field-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult insertNewFieldResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult)get_store().insert_element_user(FIELDRESULT$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "field-result" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult addNewFieldResult()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.FieldResult)get_store().add_element_user(FIELDRESULT$0);
            return target;
        }
    }

    /**
     * Removes the ith "field-result" element
     */
    public void removeFieldResult(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(FIELDRESULT$0, i);
        }
    }

    /**
     * Gets the "entity-class" attribute
     */
    public java.lang.String getEntityClass()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ENTITYCLASS$2);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "entity-class" attribute
     */
    public org.apache.xmlbeans.XmlString xgetEntityClass()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(ENTITYCLASS$2);
            return target;
        }
    }

    /**
     * Sets the "entity-class" attribute
     */
    public void setEntityClass(java.lang.String entityClass)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ENTITYCLASS$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(ENTITYCLASS$2);
            }
            target.setStringValue(entityClass);
        }
    }

    /**
     * Sets (as xml) the "entity-class" attribute
     */
    public void xsetEntityClass(org.apache.xmlbeans.XmlString entityClass)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(ENTITYCLASS$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(ENTITYCLASS$2);
            }
            target.set(entityClass);
        }
    }

    /**
     * Gets the "discriminator-column" attribute
     */
    public java.lang.String getDiscriminatorColumn()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(DISCRIMINATORCOLUMN$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "discriminator-column" attribute
     */
    public org.apache.xmlbeans.XmlString xgetDiscriminatorColumn()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(DISCRIMINATORCOLUMN$4);
            return target;
        }
    }

    /**
     * True if has "discriminator-column" attribute
     */
    public boolean isSetDiscriminatorColumn()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(DISCRIMINATORCOLUMN$4) != null;
        }
    }

    /**
     * Sets the "discriminator-column" attribute
     */
    public void setDiscriminatorColumn(java.lang.String discriminatorColumn)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(DISCRIMINATORCOLUMN$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(DISCRIMINATORCOLUMN$4);
            }
            target.setStringValue(discriminatorColumn);
        }
    }

    /**
     * Sets (as xml) the "discriminator-column" attribute
     */
    public void xsetDiscriminatorColumn(org.apache.xmlbeans.XmlString discriminatorColumn)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(DISCRIMINATORCOLUMN$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(DISCRIMINATORCOLUMN$4);
            }
            target.set(discriminatorColumn);
        }
    }

    /**
     * Unsets the "discriminator-column" attribute
     */
    public void unsetDiscriminatorColumn()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(DISCRIMINATORCOLUMN$4);
        }
    }
}
